USE [AnotherSuccessfulProcedure]

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[ClassesStatsSelect]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.ClassesStatsSelect
END


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Neil Wilson
-- Create date: 09/24/08
-- Description:	Classes Table Stats Select
-- =============================================
CREATE PROCEDURE ClassesStatsSelect

AS

BEGIN

	SELECT COUNT(Kills.Attacker_classId) AS [Kills], 0 AS [Deaths], 0.0 AS [KillDeathRatio], 
	0.0 AS [Headshot Percentage], ClassId, ClassShortName, ClassLongName FROM Classes
	LEFT OUTER JOIN Kills on Kills.Attacker_classId = Classes.ClassId
	GROUP BY ClassId, ClassShortName, ClassLongName
	ORDER BY [Kills] DESC
	
END
GO
